package tiles;

import java.util.ArrayList;

import com.jme3.math.Vector2f;

import model.AbstractModel;

import utilities.CoordConvert;
import utilities.Key;

public class HexTileModel extends AbstractModel {
	
	private int u;
	private int v;
	private int w;
	
	private ArrayList<Key> infrastructure;
	
	public HexTileModel(int u, int v, int w) {
		this.u = u;
		this.v = v;
		this.w = w;
	}
	
	public int getU() {
		return this.u;
	}
	
	public int getV() {
		return this.v;
	}
	
	public int getW() {
		return this.w;
	}
	
	public void addInfrastructure(Key key) {
		if (this.infrastructure == null) {
			infrastructure = new ArrayList<Key>();
		}		
		infrastructure.add(key);
	}
	
	public boolean removeInfrastructure(Key key) {
		if (this.infrastructure == null) {
			return false;
		}
		else {
			return infrastructure.remove(key);			
		}
	}
	
	public ArrayList<Double> getCartesian() {		
		ArrayList<Double> points;		
		points = CoordConvert.hex2Cart(u, v, w);
		
		return points;
	}
	
	public Vector2f getCartesianVec() {
		ArrayList<Double> points = getCartesian();
		
		return new Vector2f((float) points.get(0).doubleValue(), (float) points.get(1).doubleValue());
	}
	
	public ArrayList<Integer> getHex() {
		ArrayList<Integer> hexCoords = new ArrayList<Integer>();
		hexCoords.add(u);
		hexCoords.add(v);
		hexCoords.add(w);
		
		return hexCoords;
		
	}

}
